package com.basin.common.satoken.source;

import cn.dev33.satoken.stp.StpInterface;
import com.basin.api.vo.UriAuthConfigVO;
import com.basin.common.satoken.cache.AuthDataCacheProvider;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @author: Sam ZHONG | sammy1997@aliyun.com
 * @date: 2025/3/22 22:45
 * @description:
 */
@Slf4j
public class BasinAuthDataSourceReader implements StpInterface {
    @Resource
    private AuthDataCacheProvider permDataCacheProvider;

    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        return this.permDataCacheProvider.getPermDataListByLoginId(loginId);
    }

    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        return this.permDataCacheProvider.getRoleDataListByLoginId(loginId);
    }

    public List<String> getWhiteIps() {
        return this.permDataCacheProvider.getWhiteIps();
    }

    public List<String> getWhiteUserIds() {
        return this.permDataCacheProvider.getWhiteUserIds();
    }

    public List<String> getWhiteUris() {
        return this.permDataCacheProvider.getWhiteUris();
    }

    public UriAuthConfigVO getUriAuthConfig(String uriName) {
        return this.permDataCacheProvider.getUriAuthConfig(uriName);
    }
}
